package com.sf.fy.uav.applet;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * @author LTQ
 */
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class, org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration.class}, scanBasePackages = "com.sf.fy.uav")
@MapperScan("com.sf.fy.uav.*.mapper")
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 3600)
@EnableScheduling
public class SystemApplication {

    public static void main(String[] args) {
        SpringApplication.run(SystemApplication.class, args);
    }

    @Bean
    public RestTemplate restTemplate(RestTemplateBuilder builder) {
        return builder.build();
    }


//    @Bean
//    public AdminClient adminClient() {
//        //kafka客户端，在spring中创建这个bean之后可以注入并且创建topic
//        Map<String, Object> props = new HashMap<>(1);
//        //配置Kafka实例的连接地址             kafka的地址，不是zookeeper
//        props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "tkafka-svp03vad-IE-UOCS-CORE.kafkasit.sfcloud.local:1080");
//
//        return AdminClient.create(props);
//    }

    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }


}
